/*
*  Shape2D.cpp
*
*  Created on: Jan 14, 2012
*  
*/

#include  "Shape2D.h"


namespace Physics
{
#pragma region CONSTRUCTORs
	//C001: Default Constructor
	Shape2D::Shape2D()
	{
		this->position = this->direction = Vector2();
		this->speed = this->mass = 0;
	}

	//C002: Overloaded Constructor
	Shape2D::Shape2D(const Vector2 &pos)
	{
		this->position = pos;
		this->direction = Vector2();

		this->speed = this->mass = 0;
	}

	//C003: Overloaded Constructor
	Shape2D::Shape2D(const Vector2 &pos, const Vector2 &dir = Vector2() )
	{
		this->position = pos;
		this->direction = dir;
		this->speed = speed;
		this->mass = mass;
	}

	//C004: Overloaded Constructor
	Shape2D::Shape2D(const Vector2 &pos, const Vector2 &dir = Vector2(), const float speed = 0, const float mass = 0)
	{
		this->position = pos;
		this->direction = dir;
		this->speed = speed;
		this->mass = mass;
	}

	//C005: Overloaded Constructor
	Shape2D::Shape2D(const float X, const float Y, const float dir = 0, const float speed = 0, const float mass = 0)
	{
		this->position = Vector2(X, Y);
		this->direction = Vector2(dir, dir);
		this->speed = speed;
		this->mass = mass;
	}
#pragma endregion


#pragma region POSITION_PROPERTIES
	//M001: Getter Position
	const Vector2 Shape2D::getPosition() const
	{
		return this->position;
	}

	//M002: Setter Position
	void Shape2D::setPosition(const float X, const float Y)
	{
		this->position.setX(X);
		this->position.setY(Y);
	}

	//M003: Setter Position
	void Shape2D::setPosition(const Vector2 &value)
	{
		this->position.setX( value.getX() );
		this->position.setY( value.getY() );
	}
#pragma endregion


#pragma region DIRECTION_PROPERTIES
	//M004: Getter Direction
	const Vector2 Shape2D::getDirection() const
	{
		return this->direction;
	}

	//M005: Setter Direction
	void Shape2D::setDirection(const float X, const float Y)
	{
		this->direction.setX(X);
		this->direction.setY(Y);
	}

	//M006: Setter Direction
	void Shape2D::setDirection(const Vector2 &value)
	{
		this->direction.setX( value.getX() );
		this->direction.setY( value.getY() );
	}
#pragma endregion


#pragma region SPEED_PROPERTIES
	//M007: Getter Speed
	const float Shape2D::getSpeed() const
	{
		return this->speed;
	}

	//M008: Setter Speed
	void Shape2D::setSpeed(const float s)
	{
		this->speed = ( s < 0 ) ? 0 : s;
	}
#pragma endregion


#pragma region MASS_PROPERTIES
	//M009: Getter Mass
	const float Shape2D::getMass() const
	{
		return this->mass;
	}

	//M010: Setter Mass
	void Shape2D::setMass(const float m)
	{
		this->mass = ( m < 0 ) ? 0 : m;
	}
#pragma endregion

} /* NAMESPACE */
